package operation.chef;

import zy.Warehouse;

import java.util.Scanner;

/*
 *@Student 张策
 */
public class chef1 implements Ioperation {//后厨管理模块
    Scanner scanner = new Scanner(System.in);
    @Override
    public void work(Warehouse warehouse) {
        while (true) {
            System.out.println("---------仓库模块-------");
            System.out.println("1:查看库存");
            System.out.println("2:炒菜");
            System.out.println("3:扔菜");
            System.out.println("4:返回上一级");
            System.out.println();
            System.out.println("请输入您的选择:");
            String ch;
            int choice;
            while (true){
                ch=scanner.nextLine();
                if(warehouse.isNum(ch)&&Integer.parseInt(ch)<=4&&Integer.parseInt(ch)>=1){
                    choice=Integer.parseInt(ch);
                    break;
                }else {
                    System.out.println("数字不合理，请重新输入");
                }
            }
            switch (choice) {
                case 1:
                    warehouse.show();
                    break;
                case 2:
                    warehouse.cookDish();
                    break;
                case 3:
                    warehouse.throwDish();
                    break;
                case 4:
                    return;
            }
        }
    }
}
